<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/WEB-INF/view/console/common/css.html"){}	%>
 <% include("/WEB-INF/view/console/common/js.html"){} 	%>
 <title></title>
 </head>
 <body> <nav class="navbar navbar-default navbar-fixed-top site-navbar" >
  <div class="navbar-header">
 <a class="navbar-brand" href="#">用户信息</a>
 </div>
  </nav>
 <form name="sysUser_form"  id="sysUser_form" class="form-horizontal" style="margin-top: 60px;">
     <div class="form-group" >
         <label class="col-sm-2 control-label">部门</label>
         <div class="col-sm-6">
             <select   name="departmentId" id="departmentId" class="form-control" check-type="required"></select>
         </div>

     </div>
     <script>
         $(function($) {
             componentSelectInit(
                     {
                         ctxPath:'${ctxPath}',
                         tableName:"sys_department",
                         showValueField:"department_name",
                         valueField:"department_id",
                         selectId:"departmentId"
                     }
                     ,function(){
                         $("#departmentId").val("${sysUser.departmentId!''}");
                     });
         });
     </script>
   <div class="form-group" >
 <label class="col-sm-2 control-label">用户名</label>
 <div class="col-sm-6">
 <input  type="text"  name="userName" id="userName" class="form-control" check-type="required" value='${sysUser.userName!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">昵称</label>
 <div class="col-sm-6">
 <input  type="text"  name="nickName" id="nickName" class="form-control" check-type="required" value='${sysUser.nickName!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">手机号</label>
 <div class="col-sm-6">
 <input  type="text"  name="phone" id="phone" class="form-control" check-type="required" value='${sysUser.phone!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">邮箱</label>
 <div class="col-sm-6">
 <input  type="text"  name="email" id="email" class="form-control" check-type="required" value='${sysUser.email!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 control-label">状态</label>
 <div class="col-sm-6">
 <label><input checked='checked' auto_name='sysUser_status' type="radio"  name="status" value="1"/>可用</label>
 <label><input  auto_name='sysUser_status' type="radio"  name="status" value="0"/>不可用</label>
  
 </div>
  </div>
 	<script type="text/javascript">
       $(function($){
       $('input[auto_name="sysUser_status"]').each(function(){
       if('${sysUser.status!}'==this.value){ 
             $(this).attr('checked','checked');
            }
           });
 	    });
 	</script> 
  <div class="form-group" >
 <label class="col-sm-2 control-label">头像</label>
 <div class="col-sm-3">
   <span class="btn btn-success fileinput-button">
        <i class="glyphicon glyphicon-plus"></i>
        <span>添加</span>
  <input type="file" id="userPic_file" class="form-control" value='${sysUser.userPic!}' >
  <input type="hidden" id="userPic"  name="userPic"class="form-control" value='${sysUser.userPic!}' >
    </span>
  <div id="userPic_progress" class="progress">
   <div class="progress-bar progress-bar-success"></div>
  </div>
  </div>
   	<div class="col-sm-4">
   	<img id="userPic_file_show" src="${sysUser.userPic!}" style="width:100px;" alt="图片" class="img-rounded">
 </div>
 </div>

   <script type="text/javascript"> 
 $(function($){
  consoleUploadAliImg('userPic','${ctxPath}');
 });
 </script> 
   <input type='hidden' name='suId' id='suId' value='${sysUser.suId!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 <div class="form-group" style="margin-bottom: 60px;"></div>
 </form>
 <script type="text/javascript">
 $(function($) {
    /*开启表单验证*/
 	$("#sysUser_form").validation();
 });
 /*保存*/
 function saveZqForm(){
    if ($("#sysUser_form").valid() == false) {
 	    return false;
    }
    var formObject=new Object();
 formObject.departmentId=$('#departmentId').val()==''?null:$('#departmentId').val();
 formObject.userName=$('#userName').val()==''?null:$('#userName').val();
 formObject.nickName=$('#nickName').val()==''?null:$('#nickName').val(); 
 formObject.userPic=$('#userPic').val()==''?null:$('#userPic').val();
 formObject.phone=$('#phone').val()==''?null:$('#phone').val();
 formObject.email=$('#email').val()==''?null:$('#email').val(); 
 formObject.status=($('input[name="status"]:checked').val()==''?null:$('input[name="status"]:checked').val());
 formObject.suId=$('#suId').val()==''?null:$('#suId').val(); 
 
    var formObjectJson = JSON.stringify(formObject);
    $.post("${ctxPath}/console/sys_user/save",
     {
           formObjectJson :formObjectJson,
 	   table_name :'sysUser',
 	   common_token :$("#common_token").val()
     }, function(data) {
        $.confirm({
              title: '提示',
              content: data.message,
              autoClose: 'cancelAction|3000',
              escapeKey: 'cancelAction',
              buttons: {
                  cancelAction: {
                      text: '确定',
                      action: function () {
            parent.$("#sysUser").bootstrapTable("refresh");
            parent.art.dialog.get('id-dialog-sysUser').close();
                      }
                  }
              }
 		});
     });
 }
 </script>
 <nav class="navbar navbar-default navbar-fixed-bottom site-navbar" >
 <div class="container" style="padding-top:10px;padding-bottom:10px;">
 <div class="nav navbar-nav navbar-right">
 <a href="#" class="btn btn-success"  onclick='saveZqForm()'>保存 </a>
  </div>
  </div>
  </nav>
 </body>
